package com.example.famhealing.timeline;

import java.util.ArrayList;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.famhealing.R;

public class HealingtalkListAdapter extends ArrayAdapter<HealingtalkList> {

	private ArrayList<HealingtalkList> items;

	public HealingtalkListAdapter(Context context, int textViewResourceId,
			ArrayList<HealingtalkList> items) {
		super(context, textViewResourceId, items);
		this.items = items;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		View v = convertView;
		if (v == null) {

			LayoutInflater vi = (LayoutInflater) getContext().getSystemService(
					Context.LAYOUT_INFLATER_SERVICE);
			if(position%2==0)
				v = vi.inflate(R.layout.timeline_healingtalklist1, null);
			else
				v = vi.inflate(R.layout.timeline_healingtalklist2, null);
		}
		HealingtalkList healingtalkList = items.get(position);

		if (healingtalkList != null) {
			
			TextView healingtalk_name=(TextView)v.findViewById(R.id.healingtalk_name);
			TextView healingtalk_date=(TextView)v.findViewById(R.id.healingtalk_date);
			TextView healingtalk_content=(TextView)v.findViewById(R.id.healingtalk_content);
			ImageView healingtalk_img=(ImageView)v.findViewById(R.id.healingtalk_img);
			
			healingtalk_name.setText(healingtalkList.getName());
			healingtalk_date.setText(healingtalkList.getDate());
			healingtalk_content.setText(healingtalkList.getContent());
			
		}
		return v;
	}

}

class HealingtalkList {
	String date="";
	String name="";
	String img="";
	String content="";

	public HealingtalkList(String date, String img, String name, String content) {
		this.setContent(content);
		this.setDate(date);
		this.setImg(img);
		this.setName(name);
	}

	public String getDate() {
		return date;
	}

	public void setDate(String date) {
		this.date = date;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getImg() {
		return img;
	}

	public void setImg(String img) {
		this.img = img;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}
	
	

}
